//
//  PayFInishView.m
//  HeadYang
//
//  Created by sunmingming on 15/7/30.
//  Copyright (c) 2015年 xiaoluoli. All rights reserved.
//

#import "PayFInishView.h"

@interface PayFInishView ()

-(void)caPressed:(id)sender;

@end

@implementation PayFInishView

//-1 failed 0 success 1 success for whole level
- (instancetype)init{
    //solid frame,up validition is a just frame...
    CGRect solidRect = CGRectMake(0,0,280,500);
    if(!(self = [super initWithFrame:solidRect])){
        return nil;
    }
    self.backgroundColor = [UIColor whiteColor];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 280, 100)];
    label.backgroundColor = [UIColor redColor];
    label.text = @"预约成功";
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    [self addSubview:label];
    
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy年MM月dd日"];
    NSString *alertText = [NSString stringWithFormat:@"请您于%@ %02d:00准时到%@，在%@师傅处联系消费。\n地址：%@",[dateFormatter stringFromDate:APPALL.selectDate],((APPALL.startTimeFlag - 1)/4),[tooles replaceNullFromDic:APPALL.barberStoreDic withKeyArray:@[@"name"]],[tooles replaceNullFromDic:APPALL.barberDetailDic withKeyArray:@[@"name"]],[tooles replaceNullFromDic:APPALL.barberStoreDic withKeyArray:@[@"address"]]];
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 100, 280, 353)];
    textView.text = alertText;
    textView.editable = NO;
    textView.selectable = YES;
    [self addSubview:textView];
    
    UIButton *but1 = [[UIButton alloc] initWithFrame:CGRectMake(20,462,240,30)];
    but1.backgroundColor = [UIColor redColor];
    [but1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [but1 setTitle:@"确认" forState:UIControlStateNormal];
    [but1 addTarget:self action:@selector(okPressed:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:but1];
    
    return self;
}

-(IBAction)okPressed:(id)sender{
    [self.myDelegate payCancelPressed:nil];
}

-(IBAction)caPressed:(id)sender{
}

@end